package com.itstherules.jmsunit.mock;

import static com.itstherules.jmsunit.expectation.Expectations.eq;
import static com.itstherules.jmsunit.expectation.Expectations.headers;

import org.junit.Assert;
import org.junit.Test;

import com.itstherules.jmsunit.JmsInlineMock;
import com.itstherules.jmsunit.managers.QueueManagersFactory;
import com.itstherules.jmsunit.managers.QueueManagersFactory.QueueManagerType;

public class JmsUnitTest {

	final String separator = System.getProperty("line.separator");

	@Test
	public void canStoreTwoExpectations() throws Exception {
		JmsInlineMock unit = new JmsInlineMock(QueueManagersFactory.create("vm://localhost", QueueManagerType.ActiveMQ));
		
		unit.expects().through("vm://blue").with(eq("blueMessage")).reply("vm://green", "greenMessage", headers("GreenEndPoint"));
		
		Assert.assertEquals("["+separator+ 
				"Expectation: "+separator+ 
				"through: vm://blue"+separator+ 
				"with: The Expectations are: [Text is equals (expected is blueMessage)]"+separator+ 
				"reply:"+separator+ 
				"	with: greenMessage"+separator+ 
				"	to: queue vm://green"+separator+ 
				"	pretending to be: GreenEndPoint (Version=1.0&ApplOriginData=GREEN)"+separator+ 
				"]"+separator+ 
				""+separator
				, unit.toString());
	}
	
}
